﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Microsoft.VisualBasic;

namespace SalePartial.Model
{

    public class XPInquiryInfo
    {
        // Methods
        public XPInquiryInfo()
        {
            this._userID = Guid.Empty;
            this._companyID = Guid.Empty;
            this._inquiryType = string.Empty;
            this._inquiryStatus = string.Empty;
            this._partName = string.Empty;
            this._partNumber = string.Empty;
            this._partModelName = string.Empty;
            this._partModelFile = string.Empty;
            this._partMaterial = string.Empty;
            this._partDescription = string.Empty;
            this._quantity1 = string.Empty;
            this._quantity2 = string.Empty;
            this._quantity3 = string.Empty;
            this._unit = string.Empty;
            this._moderationUserID = Guid.Empty;
            this._prepaidAmount = string.Empty;
            this._paymentMethod = string.Empty;
            this._currency = string.Empty;
            this._delivery = string.Empty;
            this._addressID = Guid.Empty;
            this._deliveryComment = string.Empty;
            this._purchaseVolum = string.Empty;
            this._refPrice = string.Empty;
            this._purchasePurpose = string.Empty;
            this._partWhereUsed = string.Empty;
            this._partPicture = string.Empty;
            this._partThumbnail = string.Empty;
            this._refAttachment = string.Empty;
            this._refAtchComment = string.Empty;
            this._inquiryID = Guid.NewGuid();
            this._deleteDate = DateTime.MinValue.AddYears(0x76c);
            this._closeDate = DateTime.MinValue.AddYears(0x76c);
            this._submitDate = DateTime.MinValue.AddYears(0x76c);
            this._moderationDate = DateTime.MinValue.AddYears(0x76c);
            this._lastSaveDate = DateTime.MinValue.AddYears(0x76c);
            this._createDate = DateTime.Now;
            this._inquiryStatus = "0000000";
        }

        public XPInquiryInfo(SqlDataReader reader)
        {
            this._userID = Guid.Empty;
            this._companyID = Guid.Empty;
            this._inquiryType = string.Empty;
            this._inquiryStatus = string.Empty;
            this._partName = string.Empty;
            this._partNumber = string.Empty;
            this._partModelName = string.Empty;
            this._partModelFile = string.Empty;
            this._partMaterial = string.Empty;
            this._partDescription = string.Empty;
            this._quantity1 = string.Empty;
            this._quantity2 = string.Empty;
            this._quantity3 = string.Empty;
            this._unit = string.Empty;
            this._moderationUserID = Guid.Empty;
            this._prepaidAmount = string.Empty;
            this._paymentMethod = string.Empty;
            this._currency = string.Empty;
            this._delivery = string.Empty;
            this._addressID = Guid.Empty;
            this._deliveryComment = string.Empty;
            this._purchaseVolum = string.Empty;
            this._refPrice = string.Empty;
            this._purchasePurpose = string.Empty;
            this._partWhereUsed = string.Empty;
            this._partPicture = string.Empty;
            this._partThumbnail = string.Empty;
            this._refAttachment = string.Empty;
            this._refAtchComment = string.Empty;
            this.LoadFromReader(reader);
        }

        //public XPInquiryInfo(Guid id)
        //{
        //    this._userID = Guid.Empty;
        //    this._companyID = Guid.Empty;
        //    this._inquiryType = string.Empty;
        //    this._inquiryStatus = string.Empty;
        //    this._partName = string.Empty;
        //    this._partNumber = string.Empty;
        //    this._partModelName = string.Empty;
        //    this._partModelFile = string.Empty;
        //    this._partMaterial = string.Empty;
        //    this._partDescription = string.Empty;
        //    this._quantity1 = string.Empty;
        //    this._quantity2 = string.Empty;
        //    this._quantity3 = string.Empty;
        //    this._unit = string.Empty;
        //    this._moderationUserID = Guid.Empty;
        //    this._prepaidAmount = string.Empty;
        //    this._paymentMethod = string.Empty;
        //    this._currency = string.Empty;
        //    this._delivery = string.Empty;
        //    this._addressID = Guid.Empty;
        //    this._deliveryComment = string.Empty;
        //    this._purchaseVolum = string.Empty;
        //    this._refPrice = string.Empty;
        //    this._purchasePurpose = string.Empty;
        //    this._partWhereUsed = string.Empty;
        //    this._partPicture = string.Empty;
        //    this._partThumbnail = string.Empty;
        //    this._refAttachment = string.Empty;
        //    this._refAtchComment = string.Empty;
        //    SqlDataReader reader = XPInquiryUtility.SelectReader(id);
        //    if (reader.Read())
        //    {
        //        this.LoadFromReader(reader);
        //        reader.Close();
        //    }
        //    else
        //    {
        //        if (!reader.IsClosed)
        //        {
        //            reader.Close();
        //        }
        //        throw new ApplicationException("XPInquiryInfo does not exist.");
        //    }
        //}


        protected void LoadFromReader(SqlDataReader reader)
        {
            if ((!Information.IsNothing(reader) && !reader.IsClosed))
            {
                this._inquiryID = reader.GetGuid(0);
                this._userID = reader.GetGuid(1);
                this._companyID = reader.GetGuid(2);
                this._inquiryType = reader.GetString(3);
                this._inquiryStatus = reader.GetString(4);
                this._partName = reader.GetString(5);
                if (!reader.IsDBNull(6))
                {
                    this._partNumber = reader.GetString(6);
                }
                if (!reader.IsDBNull(7))
                {
                    this._partModelName = reader.GetString(7);
                }
                if (!reader.IsDBNull(8))
                {
                    this._partModelFile = reader.GetString(8);
                }
                if (!reader.IsDBNull(9))
                {
                    this._partMaterial = reader.GetString(9);
                }
                if (!reader.IsDBNull(10))
                {
                    this._partDescription = reader.GetString(10);
                }
                this._quantity1 = reader.GetString(11);
                this._quantity2 = reader.GetString(12);
                this._quantity3 = reader.GetString(13);
                if (!reader.IsDBNull(14))
                {
                    this._unit = reader.GetString(14);
                }
                this._createDate = reader.GetDateTime(15);
                if (!reader.IsDBNull(0x10))
                {
                    this._deleteDate = reader.GetDateTime(0x10);
                }
                if (!reader.IsDBNull(0x11))
                {
                    this._closeDate = reader.GetDateTime(0x11);
                }
                if (!reader.IsDBNull(0x12))
                {
                    this._lastSaveDate = reader.GetDateTime(0x12);
                }
                if (!reader.IsDBNull(0x13))
                {
                    this._submitDate = reader.GetDateTime(0x13);
                }
                if (!reader.IsDBNull(20))
                {
                    this._moderationDate = reader.GetDateTime(20);
                }
                if (!reader.IsDBNull(0x15))
                {
                    this._moderationUserID = reader.GetGuid(0x15);
                }
                this._expireDate = reader.GetDateTime(0x16);
                this._assignDate = reader.GetDateTime(0x17);
                this._deliveryDate = reader.GetDateTime(0x18);
                if (!reader.IsDBNull(0x19))
                {
                    this._prepaidAmount = reader.GetString(0x19);
                }
                if (!reader.IsDBNull(0x1a))
                {
                    this._paymentMethod = reader.GetString(0x1a);
                }
                if (!reader.IsDBNull(0x1b))
                {
                    this._currency = reader.GetString(0x1b);
                }
                if (!reader.IsDBNull(0x1c))
                {
                    this._delivery = reader.GetString(0x1c);
                }
                this._addressID = reader.GetGuid(0x1d);
                if (!reader.IsDBNull(30))
                {
                    this._deliveryComment = reader.GetString(30);
                }
                if (!reader.IsDBNull(0x1f))
                {
                    this._purchaseVolum = reader.GetString(0x1f);
                }
                if (!reader.IsDBNull(0x20))
                {
                    this._refPrice = reader.GetString(0x20);
                }
                if (!reader.IsDBNull(0x21))
                {
                    this._purchasePurpose = reader.GetString(0x21);
                }
                if (!reader.IsDBNull(0x22))
                {
                    this._partWhereUsed = reader.GetString(0x22);
                }
                if (!reader.IsDBNull(0x23))
                {
                    this._partPicture = reader.GetString(0x23);
                }
                if (!reader.IsDBNull(0x24))
                {
                    this._partThumbnail = reader.GetString(0x24);
                }
                if (!reader.IsDBNull(0x25))
                {
                    this._refAttachment = reader.GetString(0x25);
                }
                if (!reader.IsDBNull(0x26))
                {
                    this._refAtchComment = reader.GetString(0x26);
                }
                this._isPublic = reader.GetBoolean(0x27);
            }
        }

        // Properties
        public Guid AddressID
        {
            get { return this._addressID; }
            set { this._addressID = value; }
        }

        public DateTime AssignDate
        {
            get { return this._assignDate; }
            set { this._assignDate = value; }
        }

        public DateTime CloseDate
        {
            get { return this._closeDate; }
            set { this._closeDate = value; }
        }

        public Guid CompanyID
        {
            get { return this._companyID; }
            set { this._companyID = value; }
        }

        public DateTime CreateDate
        {
            get { return this._createDate; }
            set { this._createDate = value; }
        }

        public string Currency
        {
            get { return this._currency; }
            set { this._currency = value; }
        }

        public DateTime DeleteDate
        {
            get { return this._deleteDate; }
            set { this._deleteDate = value; }
        }

        public string Delivery
        {
            get { return this._delivery; }
            set { this._delivery = value; }
        }

        public string DeliveryComment
        {
            get { return this._deliveryComment; }
            set { this._deliveryComment = value; }
        }

        public DateTime DeliveryDate
        {
            get { return this._deliveryDate; }
            set { this._deliveryDate = value; }
        }

        public DateTime ExpireDate
        {
            get { return this._expireDate; }
            set { this._expireDate = value; }
        }

        public Guid InquiryID
        {
            get { return this._inquiryID; }
            set { this._inquiryID = value; }
        }

        public string InquiryStatus
        {
            get { return this._inquiryStatus; }
            set { this._inquiryStatus = value; }
        }

        public string InquiryType
        {
            get { return this._inquiryType; }
            set { this._inquiryType = value; }
        }

        public bool IsPublic
        {
            get { return this._isPublic; }
            set { this._isPublic = value; }
        }

        public DateTime LastSaveDate
        {
            get { return this._lastSaveDate; }
            set { this._lastSaveDate = value; }
        }

        public DateTime ModerationDate
        {
            get { return this._moderationDate; }
            set { this._moderationDate = value; }
        }

        public Guid ModerationUserID
        {
            get { return this._moderationUserID; }
            set { this._moderationUserID = value; }
        }

        public string PartDescription
        {
            get { return this._partDescription; }
            set { this._partDescription = value; }
        }

        public string PartMaterial
        {
            get { return this._partMaterial; }
            set { this._partMaterial = value; }
        }

        public string PartModelFile
        {
            get { return this._partModelFile; }
            set { this._partModelFile = value; }
        }

        public string PartModelName
        {
            get { return this._partModelName; }
            set { this._partModelName = value; }
        }

        public string PartName
        {
            get { return this._partName; }
            set { this._partName = value; }
        }

        public string PartNumber
        {
            get { return this._partNumber; }
            set { this._partNumber = value; }
        }

        public string PartPicture
        {
            get { return this._partPicture; }
            set { this._partPicture = value; }
        }

        public string PartThumbnail
        {
            get { return this._partThumbnail; }
            set { this._partThumbnail = value; }
        }

        public string PartWhereUsed
        {
            get { return this._partWhereUsed; }
            set { this._partWhereUsed = value; }
        }

        public string PaymentMethod
        {
            get { return this._paymentMethod; }
            set { this._paymentMethod = value; }
        }

        public string PrepaidAmount
        {
            get { return this._prepaidAmount; }
            set { this._prepaidAmount = value; }
        }

        public string PurchasePurpose
        {
            get { return this._purchasePurpose; }
            set { this._purchasePurpose = value; }
        }

        public string PurchaseVolum
        {
            get { return this._purchaseVolum; }
            set { this._purchaseVolum = value; }
        }

        public string Quantity1
        {
            get { return this._quantity1; }
            set { this._quantity1 = value; }
        }

        public string Quantity2
        {
            get { return this._quantity2; }
            set { this._quantity2 = value; }
        }

        public string Quantity3
        {
            get { return this._quantity3; }
            set { this._quantity3 = value; }
        }

        public string RefAtchComment
        {
            get { return this._refAtchComment; }
            set { this._refAtchComment = value; }
        }

        public string RefAttachment
        {
            get { return this._refAttachment; }
            set { this._refAttachment = value; }
        }

        public string RefPrice
        {
            get { return this._refPrice; }
            set { this._refPrice = value; }
        }

        public DateTime SubmitDate
        {
            get { return this._submitDate; }
            set { this._submitDate = value; }
        }

        public string Unit
        {
            get { return this._unit; }
            set { this._unit = value; }
        }

        public Guid UserID
        {
            get { return this._userID; }
            set { this._userID = value; }
        }


        // Fields
        private Guid _addressID;
        private DateTime _assignDate;
        private DateTime _closeDate;
        private Guid _companyID;
        private DateTime _createDate;
        private string _currency;
        private DateTime _deleteDate;
        private string _delivery;
        private string _deliveryComment;
        private DateTime _deliveryDate;
        private DateTime _expireDate;
        private Guid _inquiryID;
        private string _inquiryStatus;
        private string _inquiryType;
        private bool _isPublic;
        private DateTime _lastSaveDate;
        private DateTime _moderationDate;
        private Guid _moderationUserID;
        private string _partDescription;
        private string _partMaterial;
        private string _partModelFile;
        private string _partModelName;
        private string _partName;
        private string _partNumber;
        private string _partPicture;
        private string _partThumbnail;
        private string _partWhereUsed;
        private string _paymentMethod;
        private string _prepaidAmount;
        private string _purchasePurpose;
        private string _purchaseVolum;
        private string _quantity1;
        private string _quantity2;
        private string _quantity3;
        private string _refAtchComment;
        private string _refAttachment;
        private string _refPrice;
        private DateTime _submitDate;
        private string _unit;
        private Guid _userID;
    }


}
